#!/bin/bash
set -e
if [[ $1 == "remove" || $1 == "upgrade" || $1 == "abort-install" ]]; then

	echo "Restoring..."
	cd /var/mobile/.ivrit/
	mv restore-he.tar /
	cd /var/mobile/
	rm -drf .ivrit
	cd /
	tar xpf restore-he.tar
	chown -R mobile:mobile /var/mobile/
	iKeyEx-KBMan purge HebKeyboard
		if [[ $1 != upgrade ]]; then
			iKeyEx-KBMan remove HebKeyboard
		fi

fi
echo "Thank you and have nice day :)"
